function get(url,data={}){
	return request(url,data,'GET')
}
function post(url,data={}){
	return request(url,data,'POST')
}
function request(url, data = {}, method = 'GET',openid=wx.getStorageSync('openid')) {
	return new Promise(function(resolve, reject) {
		wx.request({
			url: url,
			data: data,
			method: method,
			header: {
				// "Content-Type": "application/json",
				"Content-Type": "application/x-www-form-urlencoded",//不知道为什么，post请求加这个才成功传到服务器
				"openid":openid
			},
			success: function(res) {
				return resolve(res)
			}
		})
	})
}

module.exports = {
	request,
	get,
	post
}